// pages/pay/pay.js
var app = getApp();
Page({

  data: {

  },
  
  onLoad: function (options) {
    var cartList = JSON.parse(options.cartList);
    var sumPrice = options.sumPrice;
    this.setData({
      cartList:cartList,
      sumPrice:sumPrice,
    })
  },


  AddressList:function(e) {
    wx.navigateTo({
      url: '../address-list/list'
    })
},
toPay:function(e) {
  var sumPrice = this.data.sumPrice;
  var userMoney = getApp().globalData.userMoney
  if(userMoney<sumPrice){
    wx.showToast({
      title: '钱包余额不足',
      icon: 'error',
      duration: 2000
    })
  }else{
    wx.navigateTo({
      url: '../topay/topay?sumPrice='+sumPrice,
    })
  }
},

})